# -*- coding: utf-8 -*-
"""
Created on Sun May 24 11:48:52 2015

@author: kelvin
"""

from optparse import OptionParser  
parser = OptionParser()  
parser.add_option("-q", "--quiet",  
                  action="store_false", dest="verbose", default=True,  
                  help="don't print status messages to stdout")  
parser.add_option("-f","--file", action="store", dest="filename", default="foo.txt") 


(options, args) = parser.parse_args()  
print options
print args



'''
可以在命令行下输入：
<yourscript> --file=outfile -q  
<yourscript> -f outfile --quiet  
<yourscript> --quiet --file outfile  
<yourscript> -q -foutfile  
<yourscript> -qfoutfile  

上面这些命令是相同效果的。除此之外，optparse还为我们自动生成命令行的帮助信息：
<yourscript> -h  
<yourscript> --help 



'''






















